package ir.values.users.constants;

import frontend.visitor.symboltbl.scope.Scope;
import ir.types.datatypes.IntegerType;

public class IntegerConst extends Constant {
    private final int constVal;
    public IntegerConst(int constVal, IntegerType type) {
        super(type);
        this.constVal = constVal;
    }
    public IntegerConst(int constVal) {
        this(constVal, IntegerType.I32);
    }

    public IntegerType getIntegerType() {
        return (IntegerType) type;
    }

    public boolean isI32() {
        return getIntegerType().isI32();
    }

    public boolean isI1() {
        return getIntegerType().isI1();
    }

    public int getValue() {
        return constVal;
    }

    @Override
    public String parseLLVM() {
        return type.toString() + " " + constVal;
    }

    public String parseUsingName() {
        return String.valueOf(constVal);
    }
}
